Teacher Version

Hero Image
Hero Image

Line Tracking Threshold

When the robot is line tracking, the color sensor detects the amount of reflected light from the surface under it. Dark surfaces absorb light, whereas bright surfaces reflect it.

Physical Robot users


  1. Using the EV3's menu, navigate to the Brick App tab and select Port View.

  2. Use the port view on the EV3 and observe the value of the Color Sensor when it is set for Reflected Light (COL - REFLECTED).

  3. Place the robot so that the color sensor is over the black line and write down the value reported on the EV3's LCD screen.

  4. Then, move the robot so that the color sensor is over the white surface and write down the value reported on the EV3's LCD screen.

Virtual Robot users


  1. Run the program and use the WASD keyboard keys to move the robot so it is over a black surface.

  2. Use the Robot > Debugger Windows > EV3 Remote Screen to see the value reported. Write it down.

  3. Use the WASD keyboard keys to move the robot so that it is over the white surface. Write down the value reported on the EV3 Remote Screen.

Quick Tip

To calculate the perfect threshold value for your environment:

Add the two values you recorded, and divide them by two.

Value on Black line = 21

Value on White surface = 133

Threshold = (133 + 21) / 2 = 154 / 2 = 77

For the most reliable results when line tracking, use this value in the second box of the lineTrackLeft and lineTrackRight command blocks.

What do you notice? How is this different from the original program?

Check Your Understanding

  1. The robot is attempting to line track a black line on a white surface. If the color sensor gives a reading above the threshold, what does this mean?
    1. The color sensor is over white.
    2. The color sensor is over black.
    3. The color sensor will never give a reading above the threshold.
    4. The threshold value is wrong.
  2. Your robot is right side line tracking. If the color sensor gets a value that is below the threshold, which way should the robot move?
    1. Forward and to the left
    2. Forward and to the right
    3. Straight forward because the line will curve eventually
    4. Turn right in place, because the right edge is that way

ClosedClick here for the Answers

A. The color sensor is over white.

B. Forward and to the right

© 2016 Robomatter, Inc.

Portions of this product are manufactured under license from Carnegie Mellon University.